<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>xeokit Example</title>
    <link href="../css/pageStyle.css" rel="stylesheet"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>
    <style>
        #downloadLink {
            position: absolute;
            font-size: 18px;
            left: 75px;
            top: 80px;
            pointer-events: all;
        }
    </style>
</head>
<body>
<input type="checkbox" id="info-button"/>
<label for="info-button" class="info-button"><i class="far fa-3x fa-question-circle"></i></label>
<canvas id="myCanvas"></canvas>
<div id="downloadLink"></div>
<div class="slideout-sidebar">
    <img class="info-icon" src="../../assets/images/bcf_logo.png"/>
    <h1>LineSet</h1>
    <h2>Creating a grid ground plane using a LineSet</h2>
    <p>In this example, we're loading a BIM model from the file system,
        while also using a LineSet to show a 2D grid under the model. </p>
    <h3>Components Used</h3>
    <h3>Components Used</h3>
    <ul>
        <li>
            <a href="../../docs/class/src/viewer/Viewer.js~Viewer.html"
               target="_other">Viewer</a>
        </li>
        <li>
            <a href="../../docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html"
               target="_other">XKTLoaderPlugin</a>
        </li>
        <li>
            <a href="../../docs/class/src/viewer/scene/LineSet/LineSet.js~LineSet.html"
               target="_other">LineSet</a>
        </li>
    </ul>
    <h3>Resources</h3>
    <ul>
        <li>
            <a href="https://github.com/openBIMstandards/DataSetSchependomlaan"
               target="_other">Model source</a>
        </li>
    </ul>
</div>

</body>

<script type="module">

    import {Viewer, XKTLoaderPlugin, LineSet, buildGridGeometry} from "../../dist/xeokit-sdk.min.es.js";

    const viewer = new Viewer({
        canvasId: "myCanvas",
        transparent: true
    });

    const camera = viewer.camera;

    viewer.camera.eye = [-2.56, 8.38, 8.27];
    viewer.camera.look = [13.44, 3.31, -14.83];
    viewer.camera.up = [0.10, 0.98, -0.14];

    const xktLoader = new XKTLoaderPlugin(viewer);

    const model = xktLoader.load({
        id: "myModel",
        src: "../../assets/models/xkt/v8/ifc/Schependomlaan.ifc.xkt",

        position: [0, 1, 0],
        edges: true,
        saoEnabled: true
    });

    const geometryArrays = buildGridGeometry({
        size: 100,
        divisions: 30
    });

    new LineSet(viewer.scene, {
        positions: geometryArrays.positions,
        indices: geometryArrays.indices,
        color: [0, 0.6, 0],
        opacity: [0.3]
    });

</script>

</html>